//import QtQuick 2.9
function isRealNum(val) {
    //isNaN()
    if (val === "" || val == null) {
        return false
    }

    if (!isNaN(val)) {
        return true
    } else {
        return false
    }
}

// 转换百分数保留两位小数
function toPercent(point) {
    if (isNaN(point))
        return "0.00%"
    var str = Number(point * 100).toFixed(2)
    str += "%"
    return str
}
///计算两个整数的百分比值
function getPercent(num, total) {
    num = parseFloat(num)
    total = parseFloat(total)
    if (isNaN(num) || isNaN(total)) {
        return "-"
    }
    return (num <= 0
            || total <= 0) ? "0.00%" : (Math.round(
                                            num / total * 10000) / 100.00 + "%")
}

//创建一个指定长度的随机数
function createID(len) {
    var seqID = parseInt(Math.pow(10, len) * Math.random()).toString()

    var addCount = len - seqID.length
    for (var i = 0; i < addCount; ++i) {
        seqID += "1"
    }
    return seqID
}
